package net.shopxx.service.impl;

import javax.annotation.Resource;

import net.shopxx.bean.Pager;
import net.shopxx.dao.OrderPointerDao;
import net.shopxx.entity.Member;
import net.shopxx.entity.OrderPointer;
import net.shopxx.service.OrderPointerService;
import net.shopxx.util.SerialNumberUtil;

import org.springframework.stereotype.Service;

/**
 * Service实现类 - 订单
 */

@Service
public class OrderPointerServiceImpl extends BaseServiceImpl<OrderPointer, String> implements OrderPointerService {
	
	@Resource
	private OrderPointerDao OrderPointerDao;

	@Resource
	public void setBaseDao(OrderPointerDao OrderPointerDao) {
		super.setBaseDao(OrderPointerDao);
	}
	
	public String getLastOrderPointerSn() {
		return OrderPointerDao.getLastOrderPointerSn();
	}
	
	public Pager getOrderPointerPager(Member member, Pager pager) {
		return OrderPointerDao.getOrderPointerPager(member, pager);
	}
	
	public Long getUnprocessedOrderPointerCount() {
		return OrderPointerDao.getUnprocessedOrderPointerCount();
	}
	
	public Long getPaidUnshippedOrderPointerCount() {
		return OrderPointerDao.getPaidUnshippedOrderPointerCount();
	}

	// 重写对象，保存时自动设置订单编号
	@Override
	public String save(OrderPointer OrderPointer) {
		OrderPointer.setOrderSn(SerialNumberUtil.buildOrderSn());
		return super.save(OrderPointer);
	}

}